<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">

		<title>产品</title>
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>jslib/bootstrap/css/bootstrap.css">
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/theme.css">
		<link rel="stylesheet"
			href="<%=basePath%>jslib/font-awesome/css/font-awesome.css">
		<script src="<%=basePath%>jslib/jquery-1.7.2.min.js"
			type="text/javascript"></script>
	</head>

	<body class="content1">
		<div class="header">
			<h1 class="page-title">
				产品管理
			</h1>
		</div>
		<ul class="breadcrumb">
			<li>
				<a href="index.jsp">Home</a>
				<span class="divider">/</span>
			</li>
			<li class="active">
				产品列表
			</li>
		</ul>
		<div class="container-fluid">
			<div class="row-fluid">
				<form class="form-inline" method="post"		action="productsearch">
					<input class="input-xlarge" placeholder="票..." name="productname"
						type="text" value="${param.productame}">
					<input class="btn icon-search" type="submit" value="查询" />
					<a class="btn btn-primary" href="product/add">
						<i class="icon-plus"></i> 新增产品
					</a>
				</form>

				<div class="well">
					<table class="table">
						<thead>
							<tr>
								<th>
									产品名称
								</th>
								<th>
									票价
								</th>
								<th>
									票数
								</th>
								<th>
									出发地
								</th>
								<th>
									目的地
								</th>
								<th>
									出发时间
								</th>
								<th>
									到达时间
								</th>
								<th>
									航班状态
								</th>
								<th style="width: 90px;">
									编辑
								</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${pi.list}" var="item">
								<tr>
									<td>
										${item.productname}
									</td>
									<td>
										${item.productprice}
									</td>
									<td>
										${item.productnum}
									</td>
									<td>
										${item.productgo}
									</td>
									<td>
										${item.productdown} 
									</td>
									<td>
										<fmt:formatDate value="${item.producttimego}"/>
									</td>
									<td>
										<fmt:formatDate value="${item.producttimedown}"/>
									</td>
									<td>
										<c:choose>
											<c:when test="${item.productstate==\"1\"}">
												待机		
											</c:when>
											<c:otherwise>起飞</c:otherwise>
										</c:choose>
									</td>
									<td>
										<a href="<%=basePath%>product/edit?productid=${item.productid}">编辑</a>
										&nbsp;
										<a href="<%=basePath%>productdelete?productid=${item.productid}">删除</a>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div class="page-info">
						<span>当前第${pi.current }页/共${pi.count }条/${pi.total }页</span>		
						<c:if test="${pi.current gt 1 }">
							<a href="<%=basePath%>productlist?current=1">首页</a>
							<a href="<%=basePath%>productlist?current=${pi.current - 1 }">上一页</a>
						</c:if>
						
						<c:if test="${pi.current lt pi.total }">
							<a href="<%=basePath%>productlist?current=${pi.current + 1 }">下一页</a>
							<a href="<%=basePath%>productlist?current=${pi.total }">尾页</a>
						</c:if>
				   </div> 
				</div>  
			</div>
		</div>
	</body>
</html>
